package org.whuims.pois.model;

import javax.persistence.*;

/**
 * Created by 声伟 on 2014/5/18 0018.
 */
@Entity
@Table(name = "cluster")
public class Cluster {
    private long id;
    private long recordid;
    private String similarid;
    private Integer count;
    private Double value;
    private String crawltime;
    private String type;
    private String category;
    private long topicId;

    //这个对应的是recordid的标题，是前台显示用的
    private String name;

    @Id
    @Column(name = "id", nullable = false, insertable = true, updatable = true)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "recordid", nullable = false, insertable = true, updatable = true)
    public long getRecordid() {
        return recordid;
    }

    public void setRecordid(long recordid) {
        this.recordid = recordid;
    }

    @Basic
    @Column(name = "similarid", nullable = true, insertable = true, updatable = true, length = 16777215)
    public String getSimilarid() {
        return similarid;
    }

    public void setSimilarid(String similarid) {
        this.similarid = similarid;
    }

    @Basic
    @Column(name = "count", nullable = true, insertable = true, updatable = true)
    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    @Basic
    @Column(name = "value", nullable = true, insertable = true, updatable = true, precision = 0)
    public Double getValue() {
        return value;
    }

    public void setValue(Double value) {
        this.value = value;
    }

    @Basic
    @Column(name = "crawltime", nullable = false, insertable = true, updatable = true, length = 255)
    public String getCrawltime() {
        return crawltime;
    }

    public void setCrawltime(String crawltime) {
        this.crawltime = crawltime;
    }

    @Basic
    @Column(name = "type", nullable = false, insertable = true, updatable = true, length = 255)
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Basic
    @Column(name = "category", nullable = true, insertable = true, updatable = true, length = 255)
    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    @Basic
    @Column(name = "topicId", nullable = false, insertable = true, updatable = true)
    public Long getTopicId() {
        return topicId;
    }

    public void setTopicId(Long topicId) {
        this.topicId = topicId;
    }

    @Transient
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Cluster cluster = (Cluster) o;

        if (id != cluster.id) return false;
        if (recordid != cluster.recordid) return false;
        if (category != null ? !category.equals(cluster.category) : cluster.category != null) return false;
        if (count != null ? !count.equals(cluster.count) : cluster.count != null) return false;
        if (crawltime != null ? !crawltime.equals(cluster.crawltime) : cluster.crawltime != null) return false;
        if (similarid != null ? !similarid.equals(cluster.similarid) : cluster.similarid != null) return false;
        if (type != null ? !type.equals(cluster.type) : cluster.type != null) return false;
        if (value != null ? !value.equals(cluster.value) : cluster.value != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + (int) (recordid ^ (recordid >>> 32));
        result = 31 * result + (similarid != null ? similarid.hashCode() : 0);
        result = 31 * result + (count != null ? count.hashCode() : 0);
        result = 31 * result + (value != null ? value.hashCode() : 0);
        result = 31 * result + (crawltime != null ? crawltime.hashCode() : 0);
        result = 31 * result + (type != null ? type.hashCode() : 0);
        result = 31 * result + (category != null ? category.hashCode() : 0);
        return result;
    }
}
